Page({
  data: {
    //判断小程序的API，回调，参数，组件等是否在当前版本可用。
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },

  bindGetUserInfo: function (res) {
    var that = this
    wx.getUserProfile({
      desc: '用于完善会员资料',
      success: (res) => {
        wx.setStorageSync('userinfo', res.userInfo)
        wx.setStorageSync('zhuangtai', true);
        wx.setStorageSync('bili', '50')
        wx.setStorageSync('xuewangbi', '13')
        wx.showToast({
          title: '登陆成功！',
          duration: 1500,
          success: function () {
            setTimeout(function () {
              wx.reLaunch({
                url: '/pages/mine/mine',
              })
            }, 1500);
            var timestamp = Date.parse(new Date());
            var date = new Date(timestamp);
            var Y = date.getFullYear();
            var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
            var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
            var day = (Y + '-' + M + '-' + D )
            console.log(day)
            wx.setStorageSync('date', day)
          }
        })
      }
    })
    console.log(res)
  },
})